Optimal. Leaf size=202 \[ -\frac {\left (-\left (a^2 (2 A+C)\right )+3 a b B-b^2 (A+2 C)\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{d (a-b)^{5/2} (a+b)^{5/2}}-\frac {\tan (c+d x) \left (A b^2-a (b B-a C)\right )}{2 b d \left (a^2-b^2\right ) (a+b \sec (c+d x))^2}+\frac {\tan (c+d x) \left (a^3 C+a^2 b B-a b^2 (3 A+4 C)+2 b^3 B\right )}{2 b d \left (a^2-b^2\right )^2 (a+b \sec (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.42, antiderivative size = 202, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {4080, 4003, 12, 3831, 2659, 208} \[ -\frac {\left (a^2 (-(2 A+C))+3 a b B-b^2 (A+2 C)\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{d (a-b)^{5/2} (a+b)^{5/2}}+\frac {\tan (c+d x) \left (a^2 b B+a^3 C-a b^2 (3 A+4 C)+2 b^3 B\right )}{2 b d \left (a^2-b^2\right )^2 (a+b \sec (c+d x))}-\frac {\tan (c+d x) \left (A b^2-a (b B-a C)\right )}{2 b d \left (a^2-b^2\right ) (a+b \sec (c+d x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 208
Rule 2659
Rule 3831
Rule 4003
Rule 4080
Rubi steps
\begin {align*} \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+b \sec (c+d x))^3} \, dx &=-\frac {\left (A b^2-a (b B-a C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}-\frac {\int \frac {\sec (c+d x) \left (2 b (b B-a (A+C))+\left (A b^2-a b B-a^2 C+2 b^2 C\right ) \sec (c+d x)\right )}{(a+b \sec (c+d x))^2} \, dx}{2 b \left (a^2-b^2\right )}\\ &=-\frac {\left (A b^2-a (b B-a C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (a^2 b B+2 b^3 B+a^3 C-a b^2 (3 A+4 C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac {\int \frac {b \left (3 a b B-a^2 (2 A+C)-b^2 (A+2 C)\right ) \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{2 b \left (a^2-b^2\right )^2}\\ &=-\frac {\left (A b^2-a (b B-a C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (a^2 b B+2 b^3 B+a^3 C-a b^2 (3 A+4 C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac {\left (3 a b B-a^2 (2 A+C)-b^2 (A+2 C)\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{2 \left (a^2-b^2\right )^2}\\ &=-\frac {\left (A b^2-a (b B-a C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (a^2 b B+2 b^3 B+a^3 C-a b^2 (3 A+4 C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac {\left (3 a b B-a^2 (2 A+C)-b^2 (A+2 C)\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{2 b \left (a^2-b^2\right )^2}\\ &=-\frac {\left (A b^2-a (b B-a C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (a^2 b B+2 b^3 B+a^3 C-a b^2 (3 A+4 C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}-\frac {\left (3 a b B-a^2 (2 A+C)-b^2 (A+2 C)\right ) \operatorname {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b \left (a^2-b^2\right )^2 d}\\ &=\frac {\left (2 a^2 A+A b^2-3 a b B+a^2 C+2 b^2 C\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} (a+b)^{5/2} d}-\frac {\left (A b^2-a (b B-a C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \sec (c+d x))^2}+\frac {\left (a^2 b B+2 b^3 B+a^3 C-a b^2 (3 A+4 C)\right ) \tan (c+d x)}{2 b \left (a^2-b^2\right )^2 d (a+b \sec (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 4.39, size = 410, normalized size = 2.03 \[ \frac {\sec (c+d x) (a \cos (c+d x)+b) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \left (\frac {a \sec (c) \left (a \sin (c+2 d x) \left (2 a^3 B-a^2 b (4 A+3 C)+a b^2 B+A b^3\right )+\sin (2 c+d x) \left (a^4 C-3 a^3 b B+a^2 b^2 (5 A+2 C)-2 A b^4\right )+\sin (d x) \left (a^4 C+5 a^3 b B-a^2 b^2 (11 A+10 C)+4 a b^3 B+2 A b^4\right )\right )-\left (a^2+2 b^2\right ) \tan (c) \left (2 a^3 B-a^2 b (4 A+3 C)+a b^2 B+A b^3\right )}{\left (a^3-a b^2\right )^2}-\frac {4 i (\cos (c)-i \sin (c)) \left (a^2 (2 A+C)-3 a b B+b^2 (A+2 C)\right ) (a \cos (c+d x)+b)^2 \tan ^{-1}\left (\frac {(\sin (c)+i \cos (c)) \left (\tan \left (\frac {d x}{2}\right ) (a \cos (c)-b)+a \sin (c)\right )}{\sqrt {a^2-b^2} \sqrt {(\cos (c)-i \sin (c))^2}}\right )}{\left (a^2-b^2\right )^{5/2} \sqrt {(\cos (c)-i \sin (c))^2}}\right )}{2 d (a+b \sec (c+d x))^3 (A \cos (2 (c+d x))+A+2 B \cos (c+d x)+2 C)} \]
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.59, size = 848, normalized size = 4.20 \[ \left [\frac {{\left ({\left (2 \, A + C\right )} a^{2} b^{2} - 3 \, B a b^{3} + {\left (A + 2 \, C\right )} b^{4} + {\left ({\left (2 \, A + C\right )} a^{4} - 3 \, B a^{3} b + {\left (A + 2 \, C\right )} a^{2} b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left ({\left (2 \, A + C\right )} a^{3} b - 3 \, B a^{2} b^{2} + {\left (A + 2 \, C\right )} a b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) + 2 \, {\left (C a^{5} + B a^{4} b - {\left (3 \, A + 5 \, C\right )} a^{3} b^{2} + B a^{2} b^{3} + {\left (3 \, A + 4 \, C\right )} a b^{4} - 2 \, B b^{5} + {\left (2 \, B a^{5} - {\left (4 \, A + 3 \, C\right )} a^{4} b - B a^{3} b^{2} + {\left (5 \, A + 3 \, C\right )} a^{2} b^{3} - B a b^{4} - A b^{5}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, {\left ({\left (a^{8} - 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} - a^{2} b^{6}\right )} d \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b - 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} - a b^{7}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b^{2} - 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} - b^{8}\right )} d\right )}}, \frac {{\left ({\left (2 \, A + C\right )} a^{2} b^{2} - 3 \, B a b^{3} + {\left (A + 2 \, C\right )} b^{4} + {\left ({\left (2 \, A + C\right )} a^{4} - 3 \, B a^{3} b + {\left (A + 2 \, C\right )} a^{2} b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left ({\left (2 \, A + C\right )} a^{3} b - 3 \, B a^{2} b^{2} + {\left (A + 2 \, C\right )} a b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) + {\left (C a^{5} + B a^{4} b - {\left (3 \, A + 5 \, C\right )} a^{3} b^{2} + B a^{2} b^{3} + {\left (3 \, A + 4 \, C\right )} a b^{4} - 2 \, B b^{5} + {\left (2 \, B a^{5} - {\left (4 \, A + 3 \, C\right )} a^{4} b - B a^{3} b^{2} + {\left (5 \, A + 3 \, C\right )} a^{2} b^{3} - B a b^{4} - A b^{5}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{8} - 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} - a^{2} b^{6}\right )} d \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b - 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} - a b^{7}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b^{2} - 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} - b^{8}\right )} d\right )}}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.41, size = 510, normalized size = 2.52 \[ \frac {\frac {{\left (2 \, A a^{2} + C a^{2} - 3 \, B a b + A b^{2} + 2 \, C b^{2}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {-a^{2} + b^{2}}} - \frac {2 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, C a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 4 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 4 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, C a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, A a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 4 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a - b\right )}^{2}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.78, size = 268, normalized size = 1.33 \[ \frac {-\frac {2 \left (-\frac {\left (4 A a b +A \,b^{2}-2 a^{2} B -B a b -2 b^{2} B +a^{2} C +4 C a b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 \left (a -b \right ) \left (a^{2}+2 a b +b^{2}\right )}+\frac {\left (4 A a b -A \,b^{2}-2 a^{2} B +B a b -2 b^{2} B -a^{2} C +4 C a b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 \left (a +b \right ) \left (a^{2}-2 a b +b^{2}\right )}\right )}{\left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b -a -b \right )^{2}}+\frac {\left (2 a^{2} A +A \,b^{2}-3 B a b +a^{2} C +2 b^{2} C \right ) \arctanh \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 7.84, size = 280, normalized size = 1.39 \[ \frac {\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A\,b^2-2\,B\,a^2-2\,B\,b^2+C\,a^2+4\,A\,a\,b-B\,a\,b+4\,C\,a\,b\right )}{{\left (a+b\right )}^2\,\left (a-b\right )}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A\,b^2+2\,B\,a^2+2\,B\,b^2+C\,a^2-4\,A\,a\,b-B\,a\,b-4\,C\,a\,b\right )}{\left (a+b\right )\,\left (a^2-2\,a\,b+b^2\right )}}{d\,\left (2\,a\,b-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (2\,a^2-2\,b^2\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (a^2-2\,a\,b+b^2\right )+a^2+b^2\right )}+\frac {\mathrm {atanh}\left (\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a-2\,b\right )\,\left (a^2-2\,a\,b+b^2\right )}{2\,\sqrt {a+b}\,{\left (a-b\right )}^{5/2}}\right )\,\left (2\,A\,a^2+A\,b^2+C\,a^2+2\,C\,b^2-3\,B\,a\,b\right )}{d\,{\left (a+b\right )}^{5/2}\,{\left (a-b\right )}^{5/2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\left (A + B \sec {\left (c + d x \right )} + C \sec ^{2}{\left (c + d x \right )}\right ) \sec {\left (c + d x \right )}}{\left (a + b \sec {\left (c + d x \right )}\right )^{3}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________